﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Glucometer.ModuleHandler;

namespace Glucometer
{
    public class DeviceStatus
    {
        public bool IsWaitingForEnding { get ; set; }

        public bool PoweredOff { get ; set; }

        public bool acPluggedIn { get; set; }

        public bool usbConnected { get; set; }

        public bool testStripInserted { get; set; }

        public OperationMode IsWaitingForModeValidation { get; set; }

        public OperationMode IsWatingForInitialization { get; set; }

        public OperationMode IsWatingForStatusCheck { get; set; }

        public DeviceStatus()
        {
            IsWatingForInitialization = 
            IsWaitingForModeValidation = 
            IsWatingForStatusCheck = OperationMode.NONE;

            IsWaitingForEnding = false;
            acPluggedIn = false;
            PoweredOff = true;
            usbConnected = false;
            testStripInserted = false;
        }

        public void UpdateStatusByEvent(SoftwareEventsType set)
        {
            if (set == SoftwareEventsType.AC_PLUGGED_IN)
                acPluggedIn = true;
            else if (set == SoftwareEventsType.AC_PLUGGED_OUT)
                acPluggedIn = false;
            else if (set == SoftwareEventsType.STRIP_INSERTED)
                testStripInserted = true;
            else if (set == SoftwareEventsType.STRIP_REMOVED)
                testStripInserted = false;
            else if (set == SoftwareEventsType.USB_INSERTED)
                usbConnected = true;
            else if (set == SoftwareEventsType.USB_REMOVED)
                usbConnected = false;
        }
    }
}